How to put an elephant on a containership in 3 steps?

Warsaw Postgres User Group
2022-06-07

logo EDB

Who am I

Image by Anemone123 from Pixabay

Containers

  • What?
  • Why?
  • How?
  • Is this for me?
Image by Gerd Altmann from Pixabay
logo EDB

What

Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. Because all of the containers share the services of a single operating system kernel, they use fewer resources than virtual machines.
Image by MirelaSchenk from Pixabay
logo EDB

What

  • isolated
  • light weight
  • secured communications
  • encapsulation of all softwares, configuration and librairies
Image by monicore from Pixabay
logo EDB

Several technologies

  • Docker
  • LXC (LinuX Containers)
  • Podman
  • ...
Image by Ulrike Leone from Pixabay
logo EDB

is that all?

  • No
  • It goes deeper
  • Here comes... Kubernetes!
Image by Design_Miss_C from Pixabay
logo EDB

Kubernetes

Kubernetes is an open-source container orchestration system for automating software deployment, scaling, and management.
Image by David Mark from Pixabay
logo EDB

Why?

  • Who has standalone Postgres nowadays?
  • Who manages less than 5 clusters in production?

➜ More things to do, less resources

Image by Ian Lindsay from Pixabay
logo EDB

DBA Tasks

  • Installations/Configurations
  • Securization
  • Backup policy implementation
  • HA policy implementation
  • Minor/Major upgrades
  • Monitoring
  • Troubleshooting
logo EDB
https://dbaday.org/
Image by Gerd Altmann from Pixabay

Changing scripting into configuration

  • installation/configurations
  • securization
  • Backup/HA implementation
  • Minor upgrades

And more!

  • Self-healing
  • Everything in one place
  • Service encapsulation
  • Self-service for devs

Stateless/statefull

The way containers are designed, and particularly the way Docker is designed, the assumption is that the container is stateless.
Mark Davis, ClusterHQ, 17 Jun 2015
Image by Niek Verlaan from Pixabay

Some tried early...

... And failed

It shouldn't be a reason not to try again!

Image by Esther Merbt from Pixabay

The key change

Kubernetes 1.14 and persistent volumes

Image by suju-foto from Pixabay

September 2021

70% of 500 executives and technology leaders are running stateful workloads in production with databases topping the list.
dok report 2021

Cloud Native PG

  • Postgres Kubernetes operator
  • Apache 2.0 license
  • In the CNCF sanbox

How?

  • Declare your configuration
  • Deploy
  • Relax
Image by 은주 송 from Pixabay
# Example of PostgreSQL cluster
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: cluster-example
spec:
  instances: 3

  primaryUpdateStrategy: unsupervised
  storage:
    size: 1Gi
Image by 은주 송 from Pixabay

Is that for you?

It depends...

  • Is your team experimented with Kubernetes?
  • Is your team experimented with Postgres?
  • Do you manage more than 5 Postgres clusters?

Caution

Your Postgres database still needs

  • Data modeling
  • Correct SQL queries
  • Careful monitoring
Image by succo from Pixabay

Any questions?

Image by Andrew Martin from Pixabay